from django.contrib import admin
from mall.models import *
# Register your models here.

class UserAdmin(admin.ModelAdmin):
    list_display = ('id','username','password')
    search_fields = ('id','username','password')

class GoodsAdmin(admin.ModelAdmin):
    list_display = ('name','price','picture','description','category','stock')
    search_fields = ('name','price','picture','description','category__name','stock')

class OrderAdmin(admin.ModelAdmin):
    list_display = ('id','user','total_price','status')
    search_fields = ('user__username','total_price','status')

class OrderGoodsAdmin(admin.ModelAdmin):
    list_display = ('order','goods','number')
    search_fields = ('order__id','goods__name','number')

class CategoryAdmin(admin.ModelAdmin):
    list_display = ('name',)
    search_fields = ('name',)


class RecommendAdmin(admin.ModelAdmin):
    list_display = ('goods','status')
    search_fields = ('goods__name','status')

admin.site.register(User,UserAdmin)
admin.site.register(Goods,GoodsAdmin)
admin.site.register(Order,OrderAdmin)
admin.site.register(OrderGoods,OrderGoodsAdmin)
admin.site.register(Category,CategoryAdmin)
admin.site.register(Recommend,RecommendAdmin)
